[PHP] Associate different data

Posted by Alex Cane on Stack Overflow See other posts from Stack Overflow or by Alex Cane
Published on 2010-03-26T22:05:30Z Indexed on 2010/03/26 22:53 UTC
Read the original article Hit count: 331

Filed under:
|
|

I will try to be as clear as possible because I can't get anybody to help me around,

I am trying to associate some data from a 'videos' table with their respective ID.

Lets say, I have column ID, title, serie, season, episode.

I am getting my data :

    <?
$result = mysql_query("SELECT * FROM videos WHERE serie = '".$row['serie']."' AND season = '".$row['season']."'");
$total_rows = mysql_num_rows($result);
       ?>

(that is in the page where you see the video itself)

So now I can get the number of episodes from a serie and season.

What I'm trying to do is have a link for the next episode, and aa link for the previous one. In the URL I am working with the id, so http://website.com/view/id/'video id here'/

So how can I get the ID of the following and previous episodes of the same season AND serie?

Help will be much appreciated!

The easiest thing I thought of is

<?=$row['id'] + 1?>
<?=$row['id'] - 1?>

But the thing is that it's mixed videos, so it wont work 100%

© Stack Overflow or respective owner

Related posts about php

Related posts about associations